
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    active:null, //收起的索引
    incomeListData:[], //数据
    earningsNum:0  //总收益
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.incomeList();
  },
  incomeList() {
    let urlStr = app.getNetAddresss("plugin.team-analysis.frontend.list.orderList");
    console.log(urlStr + '>>>>>');
    app._getNetWork({
      url: urlStr,
      success: (resdata) => {
        let res = resdata.data
        let list = res.data.list;
        // let incomeData = this.incomeListData;
        // incomeData.push(list);
        for(let i in list) {
          list[i].flag = false;
        }
        if (res.result == 1) {
          console.log(res.data.list);
          this.setData({
            incomeListData:list,
            earningsNum: res.data.sum,
          })
          console.log(res.data);
          
          console.log(this.data.incomeListData);
        } else {
          wx.showToast({
            icon: 'none',
            title: res.msg,
            duration: 1500
          });
        }
      },
      fail: function (res) {
        console.log(res);
      }
    });
  },
  onListClick(e) {
    console.log(e);
    let index = e.currentTarget.dataset.index;
    let list = this.data.incomeListData;
    list[index].flag = !list[index].flag 
    this.setData({
      incomeListData: list
    });
  },
  onTeamOrderTo(e) {
    let item = e.currentTarget.dataset.item;
    console.log(item);
    wx.navigateTo({
      url: `/packageF/teamOrder/teamOrder?start_time=${item.start_time}&end_time=${item.end_time}`,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    console.log(this.incomeListData);
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})